home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cmln0885.arc / LOGIC1.LTG < prev    next >
Text File  |  1986-02-27  |  1KB  |  43 lines

  1.  
  2.                             Listing 1
  3.  
  4.                 length of only one
  5.                 '\n' 
  6.                 BACKSPACE
  7.                         except when i = 0; á/* no input */
  8.                 NUMERIC typ
  9.                         require numbers for input
  10.                 length exhausted
  11.  
  12.  
  13. Therefore, áour conditions become :
  14.  
  15.                 length == 1 ááááááè                c == '\n' ááááááá
  16.                 c == BACKSPACE áá
  17.                 i == 0 ááááááá
  18.                 typ == NUMERIC áá
  19.                 isdigit(c) áá
  20.                 i == length 
  21.  
  22. The things we're supposed to do on various conditions are
  23.  
  24.                 ring the bell on errors
  25.                 echo the characters typed
  26.                 store the characters typed in the string provided
  27.                         implied is proper termination of the string
  28.                         and keeping track of where the current char is
  29.                 backup on legal BACKSPACEs
  30.                 return when finished
  31.  
  32.         ì
  33. Therefore, áour conditions map as follows:
  34.  
  35.  
  36.                 beep() á
  37.                 addch(c);refresh() ááá/* 'curses' screen update */
  38.                 str[i] = c ááááá
  39.                 str[i+1]='\0'
  40.                 backup(1) áááááá/* function that manages a backup */
  41.                 i++ 
  42.                 break áááááááááá/* we'll assume an infinite loop */ 
  43.